package com.xcity.game.combat.skill.impl;

import java.util.List;

import com.xcity.game.combat.Action;
import com.xcity.game.combat.ActionEffect;
import com.xcity.game.combat.attr.CombatAttributeType;
import com.xcity.game.combat.skill.CombatSkill;
import com.xcity.game.combat.unit.CombatUnit;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.skill.Skill;

/**
 * 春风化雨<br/>
 * 鼓舞员工，一次性回复所有员工{0=30#0}%生命值，冷却时间{1=3#0}回合
 * @author yang.li
 *
 */
public class COMBAT_SKILL_100006 extends CombatSkill {

	public COMBAT_SKILL_100006(Skill skill) {
		super(skill);
	}

	@Override
	public void calcDamage(Action action) {
		List<CombatUnit> units = action.unit.getTeam().all();
		float rate = skill.getParameter(0) / GameStaticConfig.percentBase;
		for (int i = 0; i < units.size(); i++) {
			CombatUnit unit = units.get(i);
			if (!unit.isDied()) {
				ActionEffect effect = action.addTarget(unit);
				int hp = (int) (unit.getMaxHp() * rate);
				effect.effect(CombatAttributeType.HP, hp);
			}
		}
	}

}
